﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Management/Management.master" AutoEventWireup="true"
    CodeFile="ADPrice.aspx.cs" Inherits="Admin_ADPrice" %>

<%@ Import Namespace="Avatar.Model" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <table>
        <tr>
            <td style="vertical-align: top;">
                广告分类：<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" DataSourceID="SqlDataSource1"
                    DataTextField="CategoryName" DataValueField="ID" 
                    OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged">
                </asp:DropDownList>
                <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                    ConnectionString="<%$ ConnectionStrings:AvatarConnectionString %>" 
                    SelectCommand="SELECT [ID], [CategoryName] FROM [ADCategory]">
                </asp:SqlDataSource>
                <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CellPadding="4"
                    ForeColor="Red" GridLines="None" EmptyDataText="暂无数据">
                    <RowStyle BackColor="#EFF3FB" />
                    <Columns>
                        <asp:TemplateField HeaderText="投放周期" SortExpression="Name">
                            <ItemTemplate>
                                <%# ((Period)Eval("Period")).Name %>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="价格(元)" SortExpression="Name">
                            <ItemTemplate>
                                <%# Eval("Price") %>
                                ￥
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="操作">
                            <ItemTemplate>
                                <asp:Button ID="btn_Update" runat="server" CommandArgument='<%# Eval("ID") %>' OnClick="btn_Update_Click"
                                    Text="编辑" />
                                <asp:Button ID="btn_Delete" runat="server" CommandArgument='<%# Eval("ID") %>' OnClick="btn_Delete_Click"
                                    Text="删除" />
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                    <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                    <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                    <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                    <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                    <EditRowStyle BackColor="#2461BF" />
                    <AlternatingRowStyle BackColor="White" />
                </asp:GridView>
                
            </td>
            <td style="vertical-align: top;">
                <asp:Button ID="btn_Add" runat="server" Text="添加" CssClass="Button" OnClick="btn_Add_Click" /><div
                    class="Dialog" id="panel_Add" runat="server">
                    <div class="Title">
                        添加</div>
                    <div class="Content">
                        <span style="color: Red;">*</span>投放周期：<asp:DropDownList ID="list_PeriodUpdate" 
                            runat="server" DataSourceID="SqlDataSource2"
                            DataTextField="Name" DataValueField="ID">
                        </asp:DropDownList>
                        <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
                            ConnectionString="<%$ ConnectionStrings:AvatarConnectionString %>" 
                            SelectCommand="SELECT [ID], [Name], [Month] FROM [Period]">
                        </asp:SqlDataSource>
                        <br />
                        <span style="color: Red;">*</span>价格：<asp:TextBox ID="txt_PriceAdd" runat="server"
                            MaxLength="10"></asp:TextBox>
                        <br />
                        <asp:Button ID="btn_AddSubmit" runat="server" Text="添加" OnClick="btn_AddSubmit_Click"
                            Width="100px" />
                        &nbsp;<asp:Button ID="btn_UpdateCancel0" runat="server" OnClick="btn_UpdateCancel_Click"
                            Text="取消" CssClass="Button" />
                    </div>
                </div>
                <div class="Dialog" id="panel_Edit" runat="server">
                    <div class="Title">
                        编辑</div>
                    <div class="Content">
                        <span style="color: Red;">*</span>价格：<asp:TextBox ID="txt_PriceUpdate" runat="server"
                            MaxLength="10"></asp:TextBox>
                        &nbsp;<br />
                        <asp:Button ID="btn_UpdateSubmit" runat="server" OnClick="btn_UpdateSubmit_Click"
                            Text="更新" CssClass="Button" />
                        &nbsp;<asp:Button ID="btn_UpdateCancel" runat="server" OnClick="btn_UpdateCancel_Click"
                            Text="取消" CssClass="Button" />
                    </div>
                </div>
                <asp:Label ID="lbl_Error" runat="server" EnableViewState="False" ForeColor="Red"></asp:Label>
            </td>
        </tr>
    </table>
</asp:Content>
